package tests;

import static org.junit.Assert.assertTrue;

import org.junit.Test;

import transformers.ContextTransformer;
import utils.Node;
import utils.TreeUtils;
import exceptions.AmbiguityException;

public class ContextTestOneNodeCase {

	@Test
	public final void testGetContext() {
		// initialization
		TreeConstants.init();
		Node configuration = TreeConstants.configuration;
		Node rule = TreeConstants.rule4;
		
		// verify
		try {
			ContextTransformer ct = new ContextTransformer(configuration);
			Node context;
			context = ct.getContext(rule);
			assertTrue(context == null);
		} catch (AmbiguityException e) {
			// print results
			System.out.println("Configuration:");
			TreeUtils.printTree(configuration, "");
			System.out.println("Rule:");
			TreeUtils.printTree(rule, "");
			System.out.println("Ambiguity:" + e.toString());
		}
		
	}

}
